from flask import Blueprint, request
from utils.Response import Response
from service.chatbot import ChatBot

#chat_bp = Blueprint('chat_bp', import_name=__name__, url_prefix='/chat')

#@chat_bp.get("")
def text_to_chat():
    data = request.get_json()
    print(data)
    if data is not None:
        content = data.get('content')
    else:
        return Response.error(message="没有请求内容")
    print("问题："+content)
    chatbot=ChatBot(123)
    result = chatbot.chat(content)
    print("回答："+result)
    return Response.success(data=result)
